import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SaleReturnOrderVO, SaleReturnOrderForm, SaleReturnOrderQuery } from '@/api/jdAndJstSceneClassification/consignmentSale/saleReturnOrder/types';

/**
 * 查询金蝶-销售退货单列表
 * @param query
 * @returns {*}
 */

export const listSaleReturnOrder = (query?: SaleReturnOrderQuery): AxiosPromise<SaleReturnOrderVO[]> => {
  return request({
    url: '/dataCheck/jd/saleReturnOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询金蝶-销售退货单列表
 * 01、定义后端接口
 * @param query
 * @returns {*}
 */
export const listSaleReturnOrderBySaleReturnCustomer1 = (query?: SaleReturnOrderQuery): AxiosPromise<SaleReturnOrderVO[]> => {
  return request({
    url: '/dataCheck/jd/saleReturnOrder/list-by-sale-return-customer1',
    method: 'get',
    params: query
  });
};

/**
 * 查询金蝶-销售退货单详细
 * @param id
 */
export const getSaleReturnOrder = (id: string | number): AxiosPromise<SaleReturnOrderVO> => {
  return request({
    url: '/dataCheck/jd/saleReturnOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增金蝶-销售退货单
 * @param data
 */
export const addSaleReturnOrder = (data: SaleReturnOrderForm) => {
  return request({
    url: '/dataCheck/jd/saleReturnOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改金蝶-销售退货单
 * @param data
 */
export const updateSaleReturnOrder = (data: SaleReturnOrderForm) => {
  return request({
    url: '/dataCheck/jd/saleReturnOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除金蝶-销售退货单
 * @param id
 */
export const delSaleReturnOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dataCheck/jd/saleReturnOrder/' + id,
    method: 'delete'
  });
};
